package io.renren.modules.welderunnormal.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.groupunnormal.entity.GroupunnormalEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.welderunnormal.entity.WelderunnormalEntity;
import io.renren.modules.welderunnormal.service.WelderunnormalService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-12-21 18:47:54
 */
@RestController
@RequestMapping("welderunnormal/welderunnormal")
public class WelderunnormalController {
    @Autowired
    private WelderunnormalService welderunnormalService;


    @GetMapping("getInfo")
    public List<WelderunnormalEntity> getInfo(@RequestParam(value = "groupName",required = false) String groupName,@RequestParam(value = "key",required = false) String welderName, @RequestParam(value = "startTime",required = false) String startTime, @RequestParam(value = "endTime",required = false) String endTime){
        return welderunnormalService.getInfo(groupName,welderName,startTime,endTime);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("welderunnormal:welderunnormal:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = welderunnormalService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{welderid}")
    @RequiresPermissions("welderunnormal:welderunnormal:info")
    public R info(@PathVariable("welderid") Integer welderid){
		WelderunnormalEntity welderunnormal = welderunnormalService.getById(welderid);

        return R.ok().put("welderunnormal", welderunnormal);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("welderunnormal:welderunnormal:save")
    public R save(@RequestBody WelderunnormalEntity welderunnormal){
		welderunnormalService.save(welderunnormal);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("welderunnormal:welderunnormal:update")
    public R update(@RequestBody WelderunnormalEntity welderunnormal){
		welderunnormalService.updateById(welderunnormal);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("welderunnormal:welderunnormal:delete")
    public R delete(@RequestBody Integer[] welderids){
		welderunnormalService.removeByIds(Arrays.asList(welderids));

        return R.ok();
    }

}
